﻿namespace EasyCMS.Core
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Microsoft.Practices.Unity;
    using Microsoft.Practices.Unity.Configuration;
    using System.Configuration;
    using Pismire;

    public class Partitions : EasyCMS.Common.IPartitions
    {
        #region Dal
        /// <summary>
        /// 通过依赖注入确定使用的数据源
        /// </summary>
        internal Dals.IPartition Dal
        {
            get
            {
                lock (syncDal)
                {
                    if (m_Dal == null)
                    {
                        m_Dal = EasyCMS.Common.Runtime.ObjectContainer.Resolve<Dals.IPartition>();
                    }
                }
                return m_Dal;
            }
        }
        private Dals.IPartition m_Dal;
        private object syncDal = new object();
        #endregion

        #region CategoryDataTable
        internal List<EasyCMS.Common.DataComponents.Partition> PartitionDataTable
        {
            get
            {
                m_PartitionDataTable = (List<EasyCMS.Common.DataComponents.Partition>)HeyCacher2.Caches.Get(PartitionDataTableCacheKey, HeyCacher2.Enums.SaveType.InProc) as List<EasyCMS.Common.DataComponents.Partition>;
                if (m_PartitionDataTable == null)
                {
                    lock (syncPartitionDataTable)
                    {
                        if (m_PartitionDataTable == null)
                        {
                            m_PartitionDataTable = Dal.GetPartitionDataTable();
                            HeyCacher2.Caches.Set(PartitionDataTableCacheKey, m_PartitionDataTable, HeyCacher2.Enums.SaveType.InProc);
                        }
                    }
                }
                return m_PartitionDataTable;
            }
        }
        private List<EasyCMS.Common.DataComponents.Partition> m_PartitionDataTable;
        private string PartitionDataTableCacheKey = "EasyCMS_PartitionDataTable";
        private object syncPartitionDataTable = new object();
        #endregion

        #region IPartitions 成员

        EasyCMS.Common.DataComponents.Partition EasyCMS.Common.IPartitions.GetByID(int id)
        {
            throw new NotImplementedException();
        }

        EasyCMS.Common.DataComponents.Partition EasyCMS.Common.IPartitions.GetByMark(string mark)
        {
            throw new NotImplementedException();
        }

        List<EasyCMS.Common.DataComponents.Partition> EasyCMS.Common.IPartitions.GetList(EasyCMS.Common.Querys.Partition query)
        {
            throw new NotImplementedException();
        }

        List<EasyCMS.Common.DataComponents.Partition> EasyCMS.Common.IPartitions.GetList(EasyCMS.Common.Querys.Partition query, out int recordCount)
        {
            throw new NotImplementedException();
        }

        ExcuteState EasyCMS.Common.IPartitions.Add(ref EasyCMS.Common.DataComponents.Partition partition)
        {
            throw new NotImplementedException();
        }

        ExcuteState EasyCMS.Common.IPartitions.Update(ref EasyCMS.Common.DataComponents.Partition partition)
        {
            throw new NotImplementedException();
        }

        ExcuteState EasyCMS.Common.IPartitions.Delete(int id)
        {
            throw new NotImplementedException();
        }

        ExcuteState EasyCMS.Common.IPartitions.CreatePartition(ref EasyCMS.Common.DataComponents.Partition partition)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
